CS 180 Final Project: Light Field CameraΒΆ
By Jathin Korrapati & Hriday ShethΒΆ
Part 0: Loading and Processing ImagesΒΆ
For this part, as per the spec, I take a set of multiple imagegs taken over some regularly spaced grid from the Stanford Light Field Archive. For the purposes of this project, I use the set of chess board rectified images and display my results for the following all below:ΒΆ
c:\Users\jkorr\anaconda3\lib\site-packages\scipy\__init__.py:138: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.3)
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion} is required for this version of "
Loading 289 images... Loaded 289 image-coordinate pairs
Part 1: Depth RefocusingΒΆ
For this part, we know based on depth perception that objects far away from the camera will not change their orientation much even when the camera moves signficantly. In order to normalize the affect of these objects in the image that are taken from slightly different perspectives, we apply depth refocusing. What this is shifting the images by their offset, which is given in their image name for the 17 x 17 grid, and subtract it by some reference image, we use the center in our case, and then scale it by a constant factor C. If the value of C is positive, this implies it corresponds to near focus, and if the value of C is negative, this corresponds to far focus. The magnitude of C represents the distance of focus itself. Below are my results for various C values between -1 and 1:ΒΆ
Part 2: Aperture AdjustmentΒΆ
For this part, we consider and modify the actual size of the aperture. To do this, we have some radius scale that determines how much we focus in our image. For example, depending on the radius value, we include more the higher the value, and less if it's lower, where the more actual content of the image included, the more the blurrier parts come into focus, which simulates a photo with a larger aperture. Intuitively, this represents a larger aperture as we expand the grid that light passes through, which lets the image expand due to larger pixel values. Below are my results for varying radius values from 1-10.ΒΆ
adjusting aperture with radius: 1 adjusting aperture with radius: 2 adjusting aperture with radius: 3 adjusting aperture with radius: 4 adjusting aperture with radius: 5 adjusting aperture with radius: 6 adjusting aperture with radius: 7 adjusting aperture with radius: 8 adjusting aperture with radius: 9 adjusting aperture with radius: 10
B&W: Interactive RefocusingΒΆ
For this part, we look at interactive refocusing. Interactive refocusing enables us to find the optimal focus parameter that brings a specific point in a scene into sharp focus. By analyzing image patches around a point across all sub-aperture views, we can determine how much to shift each view to align them properly at that depth. This works because objects at different depths show different amounts of movement (parallax) between sub-aperture views - nearby objects shift more than distant ones. The algorithm finds the focus parameter that best aligns all views at the selected point, then applies this shift to refocus the entire scene at that depth. Below are my results on two images at random pointsΒΆ
Center point: (700, 400) Optimal focus parameter: 1.000
Selected random point: (99, 299) Optimal focus parameter: 0.850